package com.bingxue.edu.management.shop.model.entity;

import com.bingxue.edu.common.enums.ClassCategoryEnum;
import com.bingxue.edu.common.enums.CommonStatusEnum;
import com.bingxue.edu.common.enums.CouponValidTypeEnum;
import com.bingxue.edu.common.enums.DiscountTypeEnum;
import com.bingxue.edu.framework.common.model.BusinessEntity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.handler.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 优惠卷模板
 *
 * @author zq
 * @since 2024/08/22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Table("shop_coupon_template")
public class CouponTemplate extends BusinessEntity {

    @Schema(description = "名称")
    private String name;

    @Schema(description = "图片")
    private String image;

    @Schema(description = "发放数量")
    private Integer distributedCount;

    @Schema(description = "领取数量")
    private Integer receivedCount;

    @Schema(description = "使用数量")
    private Integer usedCount;

    @Schema(description = "折扣类型")
    private DiscountTypeEnum discountType;

    @Schema(description = "优惠数量")
    private Double discountAmount;

    @Schema(description = "最大优惠数量")
    private Double maxDiscountAmount;

    @Schema(description = "使用门槛金额")
    private Double thresholdAmount;

    @Schema(description = "限制班级")
    @Column(typeHandler = JacksonTypeHandler.class)
    private List<String> classIdLimit;

    @Schema(description = "限制班型")
    @Column(typeHandler = JacksonTypeHandler.class)
    private List<ClassCategoryEnum> classCategoryLimit;

    @Schema(description = "限制科目")
    @Column(typeHandler = JacksonTypeHandler.class)
    private List<String> classSubjectLimit;

    @Schema(description = "限制年级")
    @Column(typeHandler = JacksonTypeHandler.class)
    private List<String> classGradeLimit;

    @Schema(description = "限制学期")
    @Column(typeHandler = JacksonTypeHandler.class)
    private List<String> classTermLimit;

    @Schema(description = "限制学年")
    @Column(typeHandler = JacksonTypeHandler.class)
    private List<String> classYearLimit;

    @Schema(description = "是否允许叠加使用")
    private Boolean stackingUseEnabled;

    @Schema(description = "是否允许多张使用")
    private Boolean multipleUseEnabled;

    @Schema(description = "每人限领数量（0不限制）")
    private Integer receiveLimitCount;

    @Schema(description = "有效期类型")
    private CouponValidTypeEnum validType;

    @Schema(description = "有效期起始时间")
    private LocalDateTime startValidTime;

    @Schema(description = "有效期结束时间")
    private LocalDateTime endValidTime;

    @Schema(description = "有效期天数")
    private Integer validDays;

    @Schema(description = "状态")
    private CommonStatusEnum status;

    @Schema(description = "描述")
    private String description;
}
